package git.bankview.wl.common;

import java.util.*;
import java.text.*;
import java.sql.*;

import laya.semi.process.*;

import git.bankview.sl.util.*;

import org.apache.log4j.Logger;

public class SqlDateGenerator
	implements IGenericClassActivity
{
	private static Logger log = Logger.getLogger(SqlDateGenerator.class);

	public void execute(IProcessContext oCtx)
		throws Exception
	{
		String[] vParam = oCtx.getActivityParameter().split(":");
		
		for (int i = 0; i < vParam.length; ++i)
		{
			String[] vDestExpr = vParam[i].split("=");
			java.util.Date oSrc = (java.util.Date)oCtx.getField(vDestExpr[0]);
			if (null == oSrc)
				oSrc = new java.util.Date();
			java.util.Date oVal = DatetimeUtil.translate(oSrc, vDestExpr[1]);
			oCtx.setField(vDestExpr[0], new java.sql.Date(oVal.getTime()));
		}
	}
}
